package src.netty.rpc.provider;

import src.netty.rpc.entity.Order;
import src.netty.rpc.pulicinterface.OrderService;

import java.math.BigDecimal;

/**
 * @author jack.wu
 * @version 1.0
 * @date 2020-06-13
 */
public class OrderServiceImpl implements OrderService {

    @Override
    public String getOrder(Long id) {
        if (id == null){
            throw new RuntimeException("非法的参数");
        }
        return builderOrder(id);
    }

    private String builderOrder(long id) {
        Order order = new Order();
        order.setId(id);
        order.setShopId(10000L);
        order.setUserId(20000L);
        order.setUserAddres("XX省XX市XX街道");
        order.setMobile("13335814715");
        order.setProductItem("格力电风扇");
        order.setPrice(new BigDecimal(199));
        order.setReallyPrice(new BigDecimal(99));
        return order.toString();
    }
}
